let AI_LIST = {
    1000: require("./../AI/AI1000"),
    1001: require("./../AI/AI1001"),
    1002: require("./../AI/AI1002"),
    1003: require("./../AI/AI1003"),
    1004: require("./../AI/AI1004")
}
class CAIManager {
    constructor() {
        this.data = {

        };
    }
    register(node, aiID) {
        if (!this.data[aiID]) {
            this.data[aiID] = {
                aiInstance: AI_LIST[aiID].createAI(),//ai的实例
                objectList: [],
            }
        }
        //将节点加入ai列表
        this.data[aiID].objectList.push(node);
    }
    //默认只传入node不传入aiid意为删除节点的所有的ai
    delAI(node, AIID = null) {
        if (AIID == null) {
            for (let ai in this.data) {
                let objList = this.data[ai].objectList;
                let ind = objList.indexOf(node);
                if (ind != -1) {
                    objList.splice(ind, 1);
                }
            }
        } else { }
    }
    clear() {
        this.data = {};
    }
    update(dt) {
        for (let aiID in this.data) {
            let info = this.data[aiID];
            for (let node of info.objectList) {
                info.aiInstance.run(node, dt);
            }
        }
    }
};
window.g_CAIManager = new CAIManager();